package reactor3;

import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;

/**
 * @program: util
 * @description:
 * @author: 周亮亮
 * @create: 2021-08-16 21:10
 **/
public class Foo {

    private void tt() throws Exception{
        long start = System.currentTimeMillis();
        Flux.just("hello", "world")
                .publishOn(Schedulers.single())
                .subscribe(result->{
                    try{
                        Thread.sleep(1000);
                        System.out.println(result);
                    } catch (Exception e) {

                    }
                }, Throwable::printStackTrace);

        System.out.println( (System.currentTimeMillis() - start) / 1000);

//        Thread.currentThread().join();

    }

    public static void main(String[] args) throws Exception{
        new Foo().tt();
    }
}
